<html>
<head>
  <link href="__PUBLIC__/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
  <link href="__PUBLIC__/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  <link href="__PUBLIC__/css/animate.min.css" rel="stylesheet">
  <link href="__PUBLIC__/css/style.min.css?v=4.0.0" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="panel panel-primary">
    <div class="panel-heading">
      对接教务系统
    </div>
    <div class="panel-body" id="sid">
      <form action="" class="form-horizontal" method="post">
        <div class="line line-dashed line-lg pull-in"></div>
        <div class="form-group">
          <label class="col-sm-2 control-label">学号</label>
          <div class="input-group">
            <span class="input-group-addon"><i class="fa fa-user"></i></span>
            <input type="text" class="form-control" v-model="content.sid">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">密码</label>
          <div class="input-group">
            <span class="input-group-addon"><i class="fa fa-credit-card"></i></span>
            <input type="password" class="form-control" v-model="content.pwd">
          </div>
        </div>
        <div class="form-group">
          <div align="center">
            <button type="button"  id="button" v-on:click="submit" class="btn btn-primary">对接</button>
          </div>
        </div>
        <div class="line line-dashed line-lg pull-in"></div>
      </form>
    </div>
  </div>
</div>
<script src="__PUBLIC__/js/vue.js"></script>
<script src="__PUBLIC__/js/vue-resource.js"></script>
<script src="__PUBLIC__/js/layui/layui.all.js"></script>
<script>
  var sid=new Vue({
      el:"#sid",
      data:{
          content:{
              sid:'',
              pwd:''
          }
      },
      methods:{
          submit:function () {
              this.$http.post('updateSid',this.content).then(
                  (data)=>
                  {
                      if (data.body.result==='success')
                          layer.msg('更新完成');
                      else
                          layer.msg('更新失败');
                  },
                  (err)=>
                  {
                      layer.msg('更新失败');
                  }
              )
              document.getElementById('button').setAttribute('disabled','true');

          }
      },
      created:function () {
          this.$http.get('currentSid').then(
              (data)=>
              {
                  this.content=data.body;
              }
          )
      }
  })
</script>
</body>
</html>
